package com.css.fxfzypg.modules.baseData.service.impl;

import com.css.fxfzypg.base.response.RestResponse;
import com.css.fxfzypg.modules.baseData.queryParams.SysDataVersionPageParam;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author Dbj
 * @date 2023年04月21日  11:20
 */
@Service
public class SysDataVersionService {

    @Value("${basicData.url1}")
    public String basicDataUrl;

    @Value("${basicData.url2}")
    public String basicDataUrl2;
    @Resource
    private DrillService drillService;


    public RestResponse versionList(SysDataVersionPageParam pageParam) {
        // String url = basicDataUrl + "/datacenter/sysDataVersion/page?dataType2="+pageParam.getDataType2();
        // url += "&page="+pageParam.getPage()+"&rows="+pageParam.getRows()+"&typeCode="+pageParam.getTypeCode();
        String url = basicDataUrl + "/datacenter/sysDataVersion/page?page="+pageParam.getPage()+"&rows="+pageParam.getRows();
        url += "&typeCode="+pageParam.getTypeCode();
        if(pageParam.getUploadStartTime()!=null){
            url += "&uploadStartTime="+pageParam.getUploadStartTime();
        }
        if(pageParam.getUploadEndTime()!=null){
            url += "&uploadEndTime="+pageParam.getUploadEndTime();
        }
        if(pageParam.getUploadUsername()!=null){
            url += "&uploadUsername="+pageParam.getUploadUsername();
        }
        if(pageParam.getVersionDesc()!=null){
            url += "&versionDesc="+pageParam.getVersionDesc();
        }
        return drillService.getJCSJ(url,2);
    }

    public RestResponse businessVersionList(SysDataVersionPageParam pageParam) {
        String url = basicDataUrl2 + "/sysDataVersion/getPage?dataTypeLevel3="+pageParam.getDataTypeLevel3();
        if(pageParam.getUploadStartTime()!=null){
            url += "&uploadStartTime="+pageParam.getUploadStartTime();
        }
        if(pageParam.getUploadEndTime()!=null){
            url += "&uploadEndTime="+pageParam.getUploadEndTime();
        }
        if(pageParam.getUploadUsername()!=null){
            url += "&uploadUsername="+pageParam.getUploadUsername();
        }
        if(pageParam.getVersionDesc()!=null){
            url += "&versionDesc="+pageParam.getVersionDesc();
        }
        return drillService.getJCSJ(url,2);
    }
}
